﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HelloWorld {
    class Program {
        static void Main(string[] args) {

            if(args.Length > 0) {
                if((args[0].Equals("Reza"))) {
                    Console.WriteLine("Yeaaaa");
                } else {
                    Console.WriteLine("Noooo");
                }
            }


            Console.WriteLine("");
            Console.WriteLine("Hello world");

            // testing out modifier
            int x = 10;
            int y = 20;
            int ans = 0;
            Console.WriteLine("");
            //Console.WriteLine("Befor call: X = {0} , Y = {1}", x, y);
            //Add(x, y, out ans);
            //Console.WriteLine("Answer is: {0}", ans);
            //Console.WriteLine("After call: X = {0} , Y = {1}", x, y);


            // testing ref modifier
            //string str1 = "Reza";
            //string str2 = "Ayadipanah";
            //Console.WriteLine("Befor call: str1 = {0} , str2 = {1}", str1, str2);
            //SwapStrings(ref str1, ref str2);
            //Console.WriteLine("After call: str1 = {0} , str2 = {1}", str1, str2);

            // testing param modifier
            // Pass in a comma-delimited list of doubles...
            double average;
            average = CalculateAverage(4.0, 3.2, 5.7, 64.22, 87.2);
            Console.WriteLine("Average of data is: " + average);

            
            Console.ReadLine();

        }


        /*
         *	The out Modifier
         */
        public static void Add(int x, int y, out int ans) {
            ans = x + y;
        }

        /*
         *	The ref Modifier
         */
        public static void SwapStrings(ref String str1, ref String str2) {
            string tempstr = str1;
            str1 = str2;
            str2 = tempstr;

        }

        /*
         *	The params Modifier
         */
        public static double CalculateAverage(params double[] values) {
            Console.WriteLine("You sent me {0} doubles.", values.Length);
            double sum = 0;
            if(values.Length == 0)
                return sum;
            for(int i = 0; i < values.Length; i++)
                sum += values[i];
            return (sum / values.Length);
        }
    }
}
